package com.itheima.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {

    //200 成功   非200 失败
    private int code;

    private Object data;

    private String msg;

    public static Result success() {
        Result result = new Result();
        result.code = 200;
        return result;
    }

    public static Result success(Object data) {
        Result result = new Result();
        result.code = 200;
        result.data = data;
        return result;
    }

    public static Result error(String msg) {
        Result result = new Result();
        result.code = 500;
        result.msg = msg;
        return result;
    }
}